import  { SAVA_USER_INFO, DELETE_USER_INFO} from '../action_type'

//创建保存用户信息的action   
export  const  createSaveUserInfoAction =(value)=>{
    //向localStorage 种保存用户信息 
    localStorage.setItem('user',JSON.stringify(value.user))
    //向localStorage 中保存token 
    localStorage.setItem('token',value.token)
    return  { type:SAVA_USER_INFO,data:value}

}

// 创建 删除 用户信息的action  
export const  createDeleteUserInfoAction =()=>{
    //从 localStorage 中删除用户信息 
    localStorage.removeItem('user')
    //从localStorage 中删除token 
    localStorage.removeItem('token')
    return { type:DELETE_USER_INFO}
}